package com.jiashihui.schema_lgorithm.java.basics;

import java.util.*;

/**
 * @ClassName CollectionTest
 * @Author Administrator
 * @Date 2019-07-13 7:07
 * @Version 1.0
 **/
public class CollectionTest {
    public static void main(String[] args) {
        testSet();
    }

    private static void testList(){
        List arrayList = new ArrayList();
        arrayList.size();

        List linkedList = new LinkedList();

        List vector = new Vector();
    }

    private static void testSet(){
        HashSet<String> hashSet = new HashSet<>();
        LinkedHashSet<String> linkedHashSet = new LinkedHashSet<>();
        TreeSet<String> treeSet = new TreeSet<>();
        for (String data : Arrays.asList("B", "A", "D", "C", "A")) {
            hashSet.add(data);
            linkedHashSet.add(data);
            treeSet.add(data);
        }
        //不保证有序
        System.out.println("Ordering in HashSet :" + hashSet);
        //FIFO保证安装插入顺序排序
        System.out.println("Order of element in LinkedHashSet :" + linkedHashSet);
        //内部实现排序
        System.out.println("Order of objects in TreeSet :" + treeSet);
    }

    private static void testMap(){

    }
}
